Don't fail if dylib outputs aren't supported
authorAlex Crichton <alex@alexcrichton.com>
Mon, 28 Sep 2015 20:52:34 +0000 (13:52 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 28 Sep 2015 20:52:34 +0000 (13:52 -0700)
Currently it's not possible to inform Cargo about target-specific crate types,
so generating a hard error whenever a dylib is seen for a target that can't
produce dylibs is a little heavy. This commit disables management of the output
dylib (which won't actually exists) and relies on the compiler to print a
warning in the case of a dylib output on a non-dylib target.

src/cargo/ops/cargo_rustc/context.rs

index 93ef0357cd3283f0d8ddb3da906295813a6b1a3c..1ba89283575ede157eb7eea10ecf4cba011154c2 100644 (file)
@@ -324,8 +324,9 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
                 for lib in libs.iter() {
                     match *lib {
                         LibKind::Dylib => {
-                            let (prefix, suffix) = try!(self.dylib(kind));
-                            ret.push(format!("{}{}{}", prefix, stem, suffix));
+                            if let Ok((prefix, suffix)) = self.dylib(kind) {
+                                ret.push(format!("{}{}{}", prefix, stem, suffix));
+                            }
                         }
                         LibKind::Lib |
                         LibKind::Rlib => ret.push(format!("lib{}.rlib", stem)),